package de.tudarmstadt.ukp.muip.fibqdojo;

import java.util.List;

import com.google.common.base.Optional;
import com.google.common.collect.Lists;

import de.tudarmstadt.ukp.muip.fibqdojo.interfaces.IFIBQFilter;
import de.tudarmstadt.ukp.muip.fibqdojo.interfaces.IFIBQRule;
import de.tudarmstadt.ukp.muip.fibqdojo.interfaces.IFIBQSentence;

public abstract class SentenceDropFilterAbstract implements IFIBQFilter {

    protected final List<IFIBQRule> filterRules = Lists.newArrayList();

    public SentenceDropFilterAbstract(IFIBQRule... filterRules) {
        for (IFIBQRule rule : filterRules) {
            this.filterRules.add(rule);
        }
    }

    @Override
    public Optional<IFIBQSentence> apply(IFIBQSentence sentence) {
        if (!keepSentence(sentence)) {
            return Optional.absent();
        }
        return Optional.of(sentence);
    }

    protected abstract boolean keepSentence(IFIBQSentence sentence);

}
